package com.yu.dao;

import com.yu.pojo.Emp;
import com.yu.pojo.vo.EmpVo;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface EmpMapper {

    List<Emp> findByPage(EmpVo empVo);

    int findCount(EmpVo empVo);

    int deleteByIds(@Param("ids") List<Integer> ids);

    @Insert("insert into emp values (null, #{username}, #{password}, #{name}, #{gender}, #{image}, #{job}, #{entrydate}, #{deptId}, #{createTime}, #{updateTime})")
    int insertEmp(Emp emp);

    @Select("select * from emp where id = #{id}")
    Emp findById(@Param("id") Integer id);

    int updateEmp(Emp emp);

    @Select("select * from emp where username = #{username} and password = #{password}")
    Emp getByUsernameAndPassword(Emp emp);

    @Delete("delete from emp where dept_id = #{deptId}")
    void deleteByDeptId(@Param("deptId") Integer deptId);
}
